﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using tmAsk.Common;

namespace tmAsk.Member
{
    public partial class MsgView : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                tmAsk.Data.MakehtmlSQL SQL = new tmAsk.Data.MakehtmlSQL();

                string id = Request.QueryString["id"];
                string uid = function.Getcookies();
                DataRow dr2 = SQL.GetList("b_user", "u_id='" + uid + "'", "u_id").Tables[0].Rows[0];
                DataRow dr = SQL.GetList("b_msg", "m_id=" + id, "*").Tables[0].Rows[0];
                if (dr2["u_id"].ToString() != dr["m_acceptuser"].ToString())
                {
                    Response.Redirect("Message.aspx");
                }
                lblTxt.Text = dr["m_content"].ToString();
                if (dr["m_content"].ToString() == "0")
                {
                    lblType.Text = "类型：管理员消息&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发送时间：" + dr["m_time"].ToString();
                }
                else
                {
                    lblType.Text = "类型：系统消息&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发送时间：" + dr["m_time"].ToString();
                }

                string sql = "update b_msg set m_isread=1 where m_id=" + id;
                SQL.ExecuteSql(sql);
            }
            catch
            {
            }

        }

    }
}